(function () {
    angular.module('app')
        .component('xxOrderInfo',{
            templateUrl:'/app/drug-manager/order-info/order-info.html',
            controller:ctrl
        });

    function ctrl($scope,$state,$stateParams,mockHttp,OrderInfoFactory) {
        $scope.orderInfo = mockHttp.orderInfo;

        /*var orderId = $stateParams.orderId;
        function getOrderInfo (orderId) {
            function cb(err, res) {
                if (!err) console.log(err, res);
                $scope.orderInfo = res;
            }
            OrderInfoFactory.getOrderInfo(orderId, cb);
        }
        getOrderInfo(orderId);*/
        
        $scope.acceptOrder = function (orderId) {
            function cb(err, res) {
                //TODO set userService
                if (!err){
                    console.log(err, res);
                }
            }
            OrderInfoFactory.acceptOrder(orderId,cb);
        };

        $scope.denyOrder = function (orderId) {
            function cb(err, res) {
                if (!err)console.log(err,res);
            }
            OrderInfoFactory.denyOrder(orderId,cb);
        }
    };
})();